﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using hxy.CopyRight;

namespace BPM.Controllers
{
	public class ErrorController : Controller
	{
		[HttpGet]
		public ActionResult NotAuthoticated()
		{
			this.ViewData["Message"] = "您的系统没有注册，不能正常使用。";

			return View();
		}

		[HttpPost]
		public ActionResult NotAuthoticated(string txtCode)
		{
			ProductRegister.Register(txtCode);
			var time = default(DateTime);
			if (ProductRegister.HasRegistered(out time))
			{
				this.ViewData["Redirect"] = true;
				this.ViewData["Message"] = string.Format("注册成功，时限：{0}。", time.ToShortDateString());
			}
			else
			{
				this.ViewData["Message"] = "注册码无效！";
			}

			return View();
		}
	}

	public class ErrorControllerActions : ControllerDefinition<ErrorController>
	{
		public readonly string NotAuthoticated = "NotAuthoticated";
	}
}